﻿Public Class RELATORIO
    Private Sub RELATORIO_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CADASTROTableAdapter.Fill(Me.CADASTRODataSet.CADASTRO)
        Me.ReportViewer1.RefreshReport()
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            Label2.Visible = True
            MaskedTextBox2.Visible = True
        Else
            Label2.Visible = False
            MaskedTextBox2.Visible = False
        End If
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If TextBox1.Text = "" Then
            MsgBox("FAVOR INFORMAR RAZÃO SOCIAL PARA PESQUISA")
        Else
            CADASTROTableAdapter.FillByRAZAO(CADASTRODataSet.CADASTRO, TextBox1.Text)
            Me.ReportViewer1.RefreshReport()
        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If TextBox2.Text = "" Then
            MsgBox("FAVOR INFORMAR NOME DO OPERADOR")
        Else
            CADASTROTableAdapter.FillByOPERADOR(CADASTRODataSet.CADASTRO, TextBox2.Text)
            ReportViewer1.RefreshReport()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If CheckBox1.Checked = True Then
            If MaskedTextBox1.Text = "  /  /" And MaskedTextBox2.Text = "  /  /" Or MaskedTextBox1.Text = "  /  /" Or MaskedTextBox2.Text = "  /  /" Then
                MsgBox("FAVOR PREENCHER TODOS OS CAMPOS DA PESQUISA")
            Else
                CADASTROTableAdapter.FillByENTREULTCONTA(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text, MaskedTextBox2.Text)
                Me.ReportViewer1.RefreshReport()
            End If
        ElseIf CheckBox1.Checked = False Then
            If MaskedTextBox1.Text = "  /  /" Then
                MsgBox("FAVOR PREENCHER TODOS OS CAMPOS DA PESQUISA")
            Else
                CADASTROTableAdapter.FillByULTCONTATO(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text)
                Me.ReportViewer1.RefreshReport()
            End If
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If CheckBox1.Checked = True Then
            If MaskedTextBox1.Text = "  /  /" And MaskedTextBox2.Text = "  /  /" Or MaskedTextBox1.Text = "  /  /" Or MaskedTextBox2.Text = "  /  /" Then
                MsgBox("FAVOR PREENCHER TODOS OS CAMPOS DA PESQUISA")
            Else
                CADASTROTableAdapter.FillByENTREAGENDA(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text, MaskedTextBox2.Text)
                Me.ReportViewer1.RefreshReport()
            End If
        ElseIf CheckBox1.Checked = False Then
            If MaskedTextBox1.Text = "  /  /" Then
                MsgBox("FAVOR PREENCHER TODOS OS CAMPOS DA PESQUISA")
            Else
                CADASTROTableAdapter.FillByAGENDAMENTO(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text)
                Me.ReportViewer1.RefreshReport()
            End If
        End If
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If CheckBox1.Checked = True Then
            CADASTROTableAdapter.FillByENTREDATAVISITA(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text, MaskedTextBox2.Text)
            Me.ReportViewer1.RefreshReport()
        ElseIf CheckBox1.Checked = False Then
            CADASTROTableAdapter.FillByDATAVISITA(CADASTRODataSet.CADASTRO, MaskedTextBox1.Text)
            ReportViewer1.RefreshReport()
        End If
    End Sub
End Class